package com.yylc.cscore.util;

import cn.hutool.core.date.DateUtil;
import com.yylc.cscore.bean.TaskBean;
import org.springframework.beans.BeanUtils;

/**
 * @author xiangnan
 * date 2018/4/27
 */
public class YYlcBeanUtils {

    public static <T> T copyProperties(Object source, T target) {
        if (source == null || target == null) {
            return null;
        }

        BeanUtils.copyProperties(source, target);

        if (target instanceof TaskBean) {
            ((TaskBean) target).setTime(DateUtil.format(((TaskBean) target).getOperateTime(), "yyyy-MM-dd"));
        }

        return target;
    }

}
